package com.woniu.cinema.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.woniu.common.annotation.Log;
import com.woniu.common.core.controller.BaseController;
import com.woniu.common.core.domain.AjaxResult;
import com.woniu.common.enums.BusinessType;
import com.woniu.cinema.domain.YhmCity;
import com.woniu.cinema.service.YhmCityService;
import com.woniu.common.utils.poi.ExcelUtil;
import com.woniu.common.core.page.TableDataInfo;

/**
 * yhmcityController
 * 
 * @author yy
 * @date 2023-09-27
 */
@RestController
@RequestMapping("/cinema/yhmcity")
public class YhmCityController extends BaseController
{
    @Autowired
    private YhmCityService yhmCityService;

    /**
     * 查询yhmcity列表
     */
    @GetMapping("/list")
    public TableDataInfo list(YhmCity yhmCity)
    {
        startPage();
        List<YhmCity> list = yhmCityService.selectYhmCityList(yhmCity);
        return getDataTable(list);
    }

    /**
     * 导出yhmcity列表
     */
    @Log(title = "yhmcity", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(YhmCity yhmCity)
    {
        List<YhmCity> list = yhmCityService.selectYhmCityList(yhmCity);
        ExcelUtil<YhmCity> util = new ExcelUtil<YhmCity>(YhmCity.class);
        return util.exportExcel(list, "yhmcity");
    }

    /**
     * 获取yhmcity详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return AjaxResult.success(yhmCityService.selectYhmCityById(id));
    }

    /**
     * 新增yhmcity
     */
    @Log(title = "yhmcity", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YhmCity yhmCity)
    {
        return toAjax(yhmCityService.insertYhmCity(yhmCity));
    }

    /**
     * 修改yhmcity
     */
    @Log(title = "yhmcity", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YhmCity yhmCity)
    {
        return toAjax(yhmCityService.updateYhmCity(yhmCity));
    }

    /**
     * 删除yhmcity
     */
    @Log(title = "yhmcity", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(yhmCityService.deleteYhmCityByIds(ids));
    }
}
